#include "OutportDynamicList.h"

#include <stdio.h>
#include <assert.h>

// sets the maxmial capacity of the list instance
#define MAX_CAPACITY 100

OutportDynamicList::OutportDynamicList()
{
	content = (IOutport**) malloc(MAX_CAPACITY * sizeof(IOutport*));
	count = 0;
}

OutportDynamicList::~OutportDynamicList()
{}

void OutportDynamicList::push_back(IOutport* p){
	assert(count < MAX_CAPACITY);
  content[count++] = p;		
}

int OutportDynamicList::size() {
	return count;
}

IOutport* OutportDynamicList::at(int i) {
	assert(i >= 0 && i < MAX_CAPACITY);
  return content[i];		
}

void OutportDynamicList::clear() {
	count = 0;
}